<template>
	<view class="container">
		<view class="loginimg">
			<image src="../../static/img/background.png" mode=""></image>
		</view>
		<view class="headportrait">
			<image src="../../static/img/login.svg" mode=""></image>
			<text>居家托养服务平台</text>
		</view>
		<view class="shuru">
			<text>账号</text>
			<uni-easyinput style="font-size: 18px;" v-model="username" type="text" value="" placeholder="请输入监护人账号" :clearable="true" :inputBorder="false"/>
		</view>
		<view class="shuru">
			<text>密码</text>
			<uni-easyinput v-model="password" type="password" value="" placeholder="请输入密码" :clearable="true" :inputBorder="false"/>
		</view>
		<view class="loginbutton">
			<button type="default" class="h_button" @click="login()">登录</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username:"",
				password:""
			}
		},
		methods: {
login(){
	uni.request({
		url:"http://121.5.35.178:8081/admin/login",
		method:"POST",
		data:{
			username:this.username,
			password:this.password
		},
		success: (res) => {
			if(res.data.code==0){
				uni.navigateTo({
					url:"../hu/home/home"
				})
			}
			
		}
	})
}
		}
	}
</script>

<style>
	.container {
		width: 100%;
		padding: 0;
		font-size: 18px;
		line-height: 24px;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.loginimg{
		width: 100%;
	}
	.loginimg>image{
		width: 100%;
	}
	.headportrait{
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 100%;
		height: 100px;
	}
	.headportrait>image{
		width: 59px;
		height: 59px;
	}
	.shuru{
		width: 80%;
		height: 40px;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1px solid #b0b0b0;
		margin: 10px auto;
	}
	.loginbutton{
		width: 60%;
	}
	.loginbutton>button{
		background-color: #3774ec;
		color: #ffffff;
	}
	.h_button:hover{
		background-color: #4335D6;
	}
		
	
</style>
